package com.test.thread;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.concurrent.ThreadPoolExecutor;

@Component
public class ThreadPoolInit {


    @Resource
    private ThreadPoolExecutor threadPoolExecutor;

    @PostConstruct
    public void init() {
        for (int i = 0; i < 100; i++) {
            threadPoolExecutor.execute(() -> {
                System.out.println(Thread.currentThread().getName() + " 线程池初始化");
            });
        }
    }
}
